import request from '@/utils/request';

// 获取异步任务列表
export const getAsyncList = (data: any) => {
    return request({
        method: 'POST',
        url: '/scrm-api/console/async/list',
        data
    });
};

// 获取异步任务详情
export const getAsyncDetailInfo = (data: any) => {
    return request({
        method: 'POST',
        url: '/scrm-api/console/async/info',
        data
    });
};

// 下载异步任务
export const doAsyncDownload = (data: any) => {
    return request({
        method: 'POST',
        url: '/scrm-api/console/async/download',
        data
    });
};

// 取消异步任务
export const doCancelAsync = (data: any) => {
    return request({
        method: 'POST',
        url: '/scrm-api/console/async/cancel',
        data
    });
};

// 导出异步任务
export const exportAsyncTask = (data: any) => {
    return request({
        method: 'POST',
        url: '/scrm-api/console/async/fail-reason-export',
        data
    });
};

// 获取异步任务所属模块
export const getAsyncTaskModule = () => {
    return request({
        method: 'POST',
        url: '/scrm-api/console/async/get-module'
    });
};

// 获取下载文件是否超过30天
export const getAsyncFileIsLost = (data: any) => {
    return request({
        method: 'POST',
        url: '/scrm-api/console/async/is-thirty',
        data
    });
};

/**
 * @description: 获取功能类型
 * @return {*}
 */
export const getAsyncFunction = () => {
    return request({
        method: 'POST',
        url: '/scrm-api/console/async/get-function'
    });
};

/**
 * @description: 获取子任务列表
 * @return {*}
 */
export const getSubTaskList = (data: any) => {
    return request({
        method: 'POST',
        url: 'scrm-api/console/async/sub-task-list',
        data
    });
};
